Installation

1. Dependencies

Note

The proposed packages requires ROS environment, CUDA support and a fully C++11-compliant compiler. Our codes have been fully tested under Ubuntu 16.04, ROS Kinetic.

1.1 Ceres Solver

Ceres solver is a C++ based non-linear optimization package, used for SLAM in our case.

Follow Ceres Installation.

1.2 OpenCV 3.4

You could follow Opencv Installation for more details.

For example, version 3.4.5. After that, uncompress both of them into the same folder.

  • Compiling with acontrib and CUDA support

cd opencv-3.4.6 && mkdir build && cd build
cmake   -D CMAKE_BUILD_TYPE=RELEASE \
        -D ENABLE_PRECOMPILED_HEADERS=OFF \
        -D BUILD_NEW_PYTHON_SUPPORT=ON \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D INSTALL_C_EXAMPLES=OFF -D WITH_TBB=ON \
        -D INSTALL_PYTHON_EXAMPLES=OFF \
        -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.5/modules \
        -D BUILD_EXAMPLES=OFF \
        -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_V4L=ON \
        -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF \
        -D BUILD_ANDROID_EXAMPLES=OFF -D BUILD_DOCS=OFF \
        -D BUILD_opencv_cnn_3dobj=OFF -D BUILD_opencv_contrib_world=OFF \
        -D BUILD_opencv_cvv=OFF -D BUILD_opencv_datasets=OFF \
        -D BUILD_opencv_dnns_easily_fooled=OFF \
        -D BUILD_opencv_structured_light=OFF \
        -D BUILD_opencv_ts=OFF -D BUILD_opencv_cudacodec=OFF \
        -D WITH_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 \
        -D WITH_CUBLAS=1 -D CUDA_GENERATION=Auto \
        -D CMAKE_CXX_FLAGS='-std=c++11' -D CUDA_NVCC_FLAGS="-std=c++11 --expt-relaxed-constexpr" ..
make -j8
sudo make install
  • Environment

echo '/usr/local/lib' | sudo tee -a /etc/ld.so.conf.d/opencv.conf
sudo ldconfig
source ~/.bashrc
pkg-config --modversion opencv    //check if opencv is installed and its version

1.3 Cereal Serialization

It is used to serialize / deserialize map points int binary, JSON / XML files swiftly and lightly. It can easily handle STD containers and smart pointers. Download it from github repository.

Note

Under Ubuntu 18.04, you have to edit CMakeLists.txt and change line 4 from OFF to ON to avoid compiling error.

mkdir build && cd build
cmake ..
make -j8
sudo make install

2. Get the source codes

2.1 Creating ROS Catkin Workspace

  • Option 1: Catkin tools (suggested approach)

    • Initialize work space
      sudo apt install python-wstool python-catkin-tools ros-kinetic-cmake-modules autoconf
      mkdir -p ~/catkin_ws/src
      cd ~/catkin_ws
      catkin init
      catkin config --extend /opt/ros/kinetic
      catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
      catkin config --merge-devel
      
    • Compile
      catkin build
      
  • Option 2: ROS native catkin package toolchain

    • Initialize work space
      mkdir -p ~/catkin_ws/src
      cd ~/catkin_ws
      
    • Compile
      catkin_make
      

2.2 Download source codes

If you want the latest version, you can clone the git repositories in ugv_stereo workspace.

The workspace can be classified into 2 categories:

  • Utilities

    • Calibration instructs how to calculate projection matrix from Matlab, as illustrated in Camera Calibration.

    • stereo_viewer can capture images from bus cameras to hard drive and use them to implement camera calibration.

    • ROS_leaflet_gps is a trajectory visualization package written in JS with OpenStreetMap.

      It reads path message from SLAM estimator and from GPS incoming data to compare their trajectories.

      cd where_your_scripts_lie/
      git clone https://gitlab.com/ugv_stereo/ROS_leaflet_gps.git
      
    • bdd-data is the supporting code for lane and curb label visualization and data format conversion needed for training LaneKerbNet using your data or BDD100K data.

    • scalabel is a versatile and scalable tool that supports various kinds of annotations needed for training computer vision models, especially for driving environment. BDD100K is labeled with this tool.

  • Source Codes

    • common_utils handles all necessary tools

      including image capturing, image undistortion and rectification, camera info publishing, multiple ROS message conversion, GPS rosnovatel driver, etc.

      cd catkin_ws/src/
      git clone https://gitlab.com/ugv_stereo/common_utils.git
      

      Read the documentation for dependencies and configuration for correct camera calibration file and ROS topic interface.

    • Obstacle_msg

      corresponds to Obstacle_msgs which is the ROS custom message for object detection.

      cd catkin_ws/src/
      git clone https://gitlab.com/ugv_stereo/obstacle_msgs.git
      
    • sslamv2

      corresponds to SSLAM Localization which is a localization and mapping package.

      cd catkin_ws/src/
      git clone -b devel https://gitlab.com/ugv_stereo/sslam_resuse.git
      
    • cubicle_detect

      corresponds to Object Detection which is an obstacle detection, tracking and classfication package.

      git clone -b devel https://gitlab.com/ugv_stereo/cubicle_detect.git
      https://gitlab.com/ugv_stereo/cubicle_detect.git
      cd cubicle_detect/darknet_ros/yolo_network_config/weights/
      wget https://pjreddie.com/media/files/yolov3-spp.weights
      cd ../../../libSGM
      mkdir build && cd build
      cmake .. && make -j8
      

      This downloads weights and generates library of stereo matching.

    • cubicle_merge is an obstacle 3D mapping and visualization package.

      cd catkin_ws/src/
      git clone https://gitlab.com/ugv_stereo/cubicle_merge.git
      
    • LaneKerbNet is a road feature detection package based on Deep Learning Nerual Network.

      git clone https://gitlab.com/ugv_stereo/lanekerbnetros.git
      

2.3 Compile Catkin Workspace

  • Option 1: Catkin tools (suggested approach)
    cd catkin_ws/
    catkin build
    
  • Option 2: ROS native catkin package toolchain
    cd catkin_ws/
    catkin_make